<!DOCTYPE html>
<html lang="en" id="html">

</html>
<script>
    async function setContent(obj) {
        document.getElementById("html").innerHTML = obj.html;
        for (var index in obj.srcs) {
            await setScript(obj.srcs[index]);
        }
        window.eval(obj.runScript);
    }
    function setScript(url) {
        return new Promise((resolve, reject) => {
            let _script = document.createElement("script");
            _script.src = url;
            _script.type = 'text/javascript';
            document.body.appendChild(_script);
            _script.onload = resolve;
            _script.onerror = function (error) {
                console.error("加载失败", error);
            }
        });

    }
</script>